﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace RSS_Downloader
{
    class MediaFileListViewItem : ListViewItem
    {
        MediaFile mediaFile;

        public MediaFile MediaFile
        {
            get { return mediaFile; }
        }

        public MediaFileListViewItem(MediaFile mediaFile)
        {
            this.mediaFile = mediaFile;

            this.Checked = true;
            this.Text = mediaFile.Uri.AbsoluteUri;
            this.SubItems.Add(mediaFile.Length.ToHumanString());
        }
    }

    class MediaFileListViewItemComparer : IEqualityComparer<MediaFileListViewItem>
    {
        public bool Equals(MediaFileListViewItem x, MediaFileListViewItem y)
        {
            return x.MediaFile.Uri == y.MediaFile.Uri;
        }

        public int GetHashCode(MediaFileListViewItem obj)
        {
            return obj.MediaFile.Uri.GetHashCode();
        }

    }
}
